package com.dly.blog.properties;

import com.baomidou.mybatisplus.generator.config.OutputFile;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.List;
import java.util.Map;

@Data
@NoArgsConstructor
@ConfigurationProperties(prefix = CodeGenProperties.PREFIX)
public class CodeGenProperties {

    public static final String PREFIX = "blog" + ".gen";

    private BaseConfig baseConfig;

    private Datasource datasource;


    @Data
    public static class BaseConfig {

        /**
         * 作者
         */
        private String author;

        /**
         * 包路径 com.xx.xx
         */
        private String page;

        /**
         * 包文件路径 com/xx/xx
         */
        private String filePage;

        /**
         * src路径 src/main/java
         */
        private String src;

        /**
         * 模块项目名称 blog-content
         */
        private String projectName;

        /**
         * 模块路由 content => ("/content")
         */
        private String baseUrl;

        /**
         * 前端接口目录 path: C:\project\open\chat-gpt-front\src\api
         */
        private String fountApiPath;

        /**
         * 需要生成的表
         */
        private List<String> tableNames;

        /**
         * 需要忽略的前缀
         */
        private String tablePrefix;

        /**
         * 各个文件的生成路径
         */
        private Map<OutputFile, String> maps;
    }

    @Data
    public static class Datasource {

        private String  url;

        private String username;

        private String password;

    }
}
